package com.dfbz.demo01_Reader;

import java.io.FileReader;
import java.io.Reader;

/**
 * @author lscl
 * @version 1.0
 * @intro:
 */
public class Demo02_读取单个字符 {


    public static void main(String[] args) throws Exception {
        Reader reader = new FileReader("001.txt");
        int data;
        while ((data = reader.read()) != -1) {
            System.out.print((char)data);
        }
        reader.close();
    }

    public static void test(String[] args) throws Exception {

        Reader reader = new FileReader("001.txt");

        System.out.println((char) reader.read());
        System.out.println((char) reader.read());
        System.out.println((char) reader.read());
        System.out.println((char) reader.read());
        System.out.println((char) reader.read());
        System.out.println(reader.read());
        System.out.println(reader.read());
        System.out.println(reader.read());

        reader.close();
    }
}
